package com.demo.controller;

import com.demo.annotations.RequestKeyParam;
import com.demo.annotations.RequestLock;
import com.demo.entity.User;
import com.demo.service.UserService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author KingYan
 * @date 2024/6/18
 * @apiNote
 */
@RestController
@RequestMapping("/user")
public class UserController {

	@Resource
	private UserService userService;

	@RequestLock
	@PostMapping("/addUser")
	public ResponseEntity<User> addUser(@RequestBody @RequestKeyParam User user) {
		return ResponseEntity.ok(userService.addUser(user));
	}
}
